package cn.suiwei.provider.service;

import cn.suiwei.service.AnnotateDemoService;
import com.alibaba.dubbo.config.annotation.Service;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import lombok.extern.slf4j.Slf4j;

/**
 * @author suiwei
 * @date 2023-02-23 13:51
 */
//dubbo:service标签对应的就是@Service，标签里的属性，在@Service里面也可以使用
@Service(timeout = 3000)
@Slf4j
public class AnnotateDemoServiceImpl implements AnnotateDemoService {


    @HystrixCommand
    @Override
    public String getAnnotateDemo() {
        if(Math.random()>0.5){
            throw new RuntimeException();
        }
        return "注解版调用成功";
    }
}
